/**************************************************************************************
*
*	Copyright (C) 2009 - 2012 Brent Andrew O. Chua - See LICENSE.txt for more info.
*		
*	Filename	-	ParameterBinderSamplerState.cpp
*
*	Comments	-	See ParameterBinderSamplerState.h
*
**************************************************************************************/
#include "../Include/ParameterBinderSamplerState.h"
#include "../Include/ParameterSamplerState.h"

namespace Pulse
{
	ParameterBinderSamplerState::ParameterBinderSamplerState( void )
		: m_pState( PSX_NULL )
	{

	}

	ParameterBinderSamplerState::ParameterBinderSamplerState( IParameter *pParam )
		: m_pState( PSX_NULL )
	{
		SetParameter( pParam );
	}

	ParameterBinderSamplerState::~ParameterBinderSamplerState( void )
	{
		if ( m_pState )
			m_pState->Release();
	}

	void ParameterBinderSamplerState::SetData( SamplerState *pState )
	{
		if ( m_pState )
			m_pState->Release();

		m_pState = pState;

		if ( pState )
			pState->AddRef();
	}

	void ParameterBinderSamplerState::BindValue( void )
	{
		m_pSamplerStateParam->SetSamplerState( m_pState );
	}
}